﻿// 功能：弹出对话框按钮
// 描述：
// 作者：温伟鹏
// 日期：2010/9/10 14:51:29

using System;
using MeizuSDK.Drawing;

namespace MeizuSDK.Presentation
{
    /// <summary>
    /// 弹出对话框按钮
    /// </summary>
    public class PopupDialogButton
    {
        /// <summary>
        /// 当按钮被单击后触发此事件
        /// </summary>
        public event EventHandler Click;

        #region 公共属性
        /// <summary>
        /// 获取或设置按钮文本
        /// </summary>
        public string Text
        {
            get;
            set;
        }
        /// <summary>
        /// 获取或设置按钮默认图像
        /// </summary>
        public ImagingHelper Image
        {
            get;
            set;
        }
        /// <summary>
        /// 获取或设置按钮按下时显示的图像
        /// </summary>
        public ImagingHelper PressedImage
        {
            get;
            set;
        }
        /// <summary>
        /// 获取按钮的Id
        /// </summary>
        public uint Id
        {
            get;
            internal set;
        }
        /// <summary>
        /// 获取按钮所在的对话框
        /// </summary>
        public PopupDialog Owner
        {
            get;
            internal set;
        }
        #endregion

        #region 构造函数
        /// <summary>
        /// 构造弹出对话框按钮实例
        /// </summary>
        public PopupDialogButton()
            : this(string.Empty)
        {

        }
        /// <summary>
        /// 构造弹出对话框按钮实例
        /// </summary>
        /// <param name="text">按钮文本</param>
        public PopupDialogButton(string text)
            : this(text, null, null)
        {

        }
        /// <summary>
        /// 构造弹出对话框按钮实例
        /// </summary>
        /// <param name="text">按钮文本</param>
        /// <param name="image">按钮普通状态的图像</param>
        /// <param name="pressedImage">按钮按下时的图像</param>
        public PopupDialogButton(string text, ImagingHelper image, ImagingHelper pressedImage)
        {
            Text = text;
            Image = image;
            PressedImage = pressedImage;
        }
        #endregion

        #region 函数
        /// <summary>
        /// 触发单击事件
        /// </summary>
        internal void RaiseClickEvent()
        {
            if(Click!=null)
            {
                Click(this, EventArgs.Empty);
            }
        }
        #endregion
    }
}
